<div class="container-fluid suredy-form" style="padding-top: 0">
	<div class="row">	
	<form name="form" id="form">
	<#if role??>
		<div class="form-group">
			<div class="input-group">
				<div class="input-group-addon">角色代码</div>
				<input type="text" class="form-control" name="name" readonly="readonly" value="${role.groupName}" />
			</div>
		</div>
		<div class="form-group">	
			<div class="input-group">
				<div class="input-group-addon">角色名称</div>
				<input type="text" class="form-control" name="name" readonly="readonly" value="${role.mc}" />
				<input type="hidden"  name="id" value="${role.id}" />
			</div>
		</div>
	</#if>	
		<div class="form-group">
			<table  class="table table-striped table-bordered table-hover">						
				<tr>
					<th>用户代码</th>
					<th>单位代码</th>
					<th>用户名</th>
					<th>完整用户名</th>
					<th style="text-align:center; width:80px;">包含</th>
				</tr>
				<#if users??> <#list users as user>
				<tr>
					<td>${user.userCode}</td>
					<td>${user.unitCode}</td>
					<td>${user.shortName}</td>
					<td>${user.fullName}</td>
					<#assign isChecked="" />
					<#if relations??><#list relations as relation>
			        	<#if relation.userId == user.id >
			        	    <#assign isChecked="checked=\"checked\"" />
			        	    <#break>
			        	</#if>
			        </#list></#if>
					<td class="text-center"><input type="checkbox" name="userId" ${isChecked} value="${user.id}"  /></td>
				</tr>
				</#list></#if>
			</table>
		</div>
		<div class="text-center">
			<button class="btn btn-info" id="btn-save" type="button">
				<i class="icon-save"></i>
				保存
			</button>
		</div>	
	</form>	
	</div>
</div>
<script type="text/javascript">
	$(document).ready(function() {
		$('#btn-save').click(function() {
			$.ajax({
				type : 'POST',//发送请求的方式
				url : 'role2user-save.do',
				data : $('#form').serialize(),
				dataType : "json",//文件类型
				cache : false,
				timeout : 60000,//超时设置，单位为毫秒
				error : function(XMLHttpRequest, textStatus, errorThrown) {
					alert("未知错误,提交信息失败...");
				},
				success : function(result) {
					alert(result==1 ? '已保存' : '保存失败');
				}
			});		
		});	
	});
</script>	
